#define _CRT_SECURE_NO_WARNINGS 1
#include <exception>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
class A
{
public:
    bool operator()(int x, int y)
    {
        return x > y;
    }
};
int main()
{
    int n = 0, k = 0;
    cin >> n >> k;
    cerr << "n=" << n << ",k=" << k << endl;
    priority_queue<int, vector<int>, A> pq;
    int tmp = 0;
    for (int i = 0;i < n;i++)
    {
        cin >> tmp;
        pq.push(tmp);
    }
    int count = 0;
    int day = -1;
    while (count <= k)
    {
        day++;
        tmp = pq.top();
        pq.pop();
        count += tmp;
        pq.push(tmp * 2);
    }
    cerr << day << endl;
    cout << day << endl;
    return 0;
}
